package com.doubao.config;


import com.doubao.config.properties.DouBaoProperties;
import com.volcengine.ark.runtime.service.ArkService;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.time.Duration;

@Configuration
@RequiredArgsConstructor
public class ArkServiceConfig {

    private final DouBaoProperties properties;

    @Bean
    public ArkService arkService() {
        return ArkService.builder()
                .apiKey(properties.getApiKey())
                .baseUrl(properties.getBaseUrl())
                .timeout(Duration.ofSeconds(properties.getTimeout()))
                .retryTimes(properties.getRetryTimes())
                .build();
    }
}
